package cn.foolishbird.business.tool.task;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Eric
 * @version 1.0
 * @date 2020-11-16
 */
public class IncrementTaskNoGenerator implements TaskNoGenerator<Long> {

    private int start = 1;

    private AtomicLong no;

    public IncrementTaskNoGenerator() {
        this.no = new AtomicLong(this.start);
    }

    public IncrementTaskNoGenerator(int start) {
        this.start = start;
        this.no = new AtomicLong(this.start);
    }

    @Override
    public Long taskNo() {
        return no.getAndIncrement();
    }
}
